<?php
namespace app\models;

use app\pays\CustomCommon;

class QueryUserManager extends CustomCommon
{
	/*
	*查看是否有效客户
	*phone:手机号码
	*cardno 充值卡号
	*返回的是老的金额
	*/
	public function IsValidUser($type,$phone,$cardno,$cardtype)
	{
		if(isset($this->config['query'][$type]))
		{
			//获取充值卡号
			$url=$this->config['query'][$type];
			switch($cardtype)
			{
					
				case 'XINSUAN':
					//往卡上充值-微信支付并到芯算卡上充值 type==7是固定的，不要随意修改
					$rechargeUrl=$url."&phone=$phone&cardno=$cardno";
					$this->paylogs("查询会员接口:".$rechargeUrl);
					$result=$this->RequestUrl($rechargeUrl,"get");
					$this->paylogs(json_encode($result));
					if($result['code']==-1)
					{
						$this->paylogs("手机号".$phone."卡号".$cardno."会员查询接口报错：".$result['message']);
						$this->errormsg($result['message']);
					}
					return $result['attach'];
					break;
				default:
					$this->errormsg("手机号".$phone."卡号".$cardno."会员查询接口未进行逻辑处理");
					break;
			}
		}
		else
		{
			$this->errormsg("手机号".$phone."卡号".$cardno."未找到会员查询接口");
		}
	}
}